package com.leyou.service.impl;

import com.leyou.entity.SpecGroup;
import com.leyou.mapper.SpecGroupMapper;
import com.leyou.service.SpecGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

@Service
public class SpecGroupServiceImpl implements SpecGroupService {

    @Autowired
    private SpecGroupMapper specGroupMapper;

    @Override
    public List<SpecGroup> getSpecGroups(Long cid) throws Exception {
        Example example = new Example(SpecGroup.class);
        if (cid > 0) {
            example.createCriteria().andEqualTo("cid", cid);
        }
        List<SpecGroup> specGroups = specGroupMapper.selectByExample(example);
        return specGroups;
    }
}
